package com.azt.provider.mapper;

import com.azt.api.dto.*;
import com.azt.api.enums.UserEnum;
import com.azt.api.pojo.Role;
import com.azt.api.pojo.User;
import com.azt.api.pojo.UserVO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface UserMapper extends Mapper<User> {

	int getIndexUserCount();

    public List<UserCompany> searchUser(Map param);
    
    public List<User> selectByCompanyId(int id);

	public List<User> getUserByAdminRole(@Param("companyId")Integer companyId, @Param("AdminRole")List<Role> ifAdminRole);
	
	public List<UserVO> queryPageUserListByCompanyId(Map<String, String> params);
	
	public Integer queryApplyUserCount(String companyId,String state);
	
	public void unbindUserFromCompany(String userid);
	
	public Integer queryRoleByCompanyId(String companyId,String roleType);
	
	public User queryUserBylogin(String login);

	public List<UserAuthority> getUserAuthorityByCompanyId(@Param("companyId")Integer companyId, @Param("userenum")List<UserEnum> userenum);

	public UserAuthority getUserAuthorityByUserId(@Param("userId")Integer userId, @Param("userenum")List<UserEnum> userenum);

	public List<UserAuthority> getUserAuthorityAdminByCompanyId(Integer companyId);

	/**
	 * 统计, 每月用户新增
	 * Created by 张栋 on 2016/12/16 10:48
	 */
    List<UserForEcharts> echartsAdded();

	/**
	 * 统计, 每月用户新增  认证的
	 * Created by 张栋 on 2016/12/16 10:48
	 */
    List<UserForEcharts> echartsAddedAuth();

	/**
	 * 根据报价id获取发布询价的用户
	 * @param quoteId
	 * @return
	 */
	public User getUserByQuoteId(Integer quoteId);


	/**
	 * 查所有领导,根据code.查出所有用户id ,用来发短信
	 * pleader,供应商    cleader采购
	 * Created by 张栋 on 2016/12/28 10:24
	 */
    List<UserExt> getAllLeaderIds(@Param("code") String code);

	/**
	 * 晒用户的统计信息,   每月通知给领导
	 * Created by 张栋 on 2016/12/28 14:00
	 */
	UserForMonthTip  getUserForMonthTip(@Param("userid") Integer userid, @Param("code") String code, @Param("year") Integer year, @Param("month") Integer month);

	List<User> getUserByIngralRule(String recordTime);

	List<Map> statisticsUser(Map param);

	List<Map> statisticsUserDetail(Map param);
}